package edu.gatech.cs2340.mule.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import edu.gatech.cs2340.mule.presenter.MuleGamePresenter;

/**
 * This class represents the panel for the title screen.
 * 
 * Author: J.R. O'Donnell
 */
public class TitleScreenPanel extends JFrame {
	
	private JButton newGameButton;
	private JButton loadGameButton;
	private JLabel logo;
	
	/**
	 * Initialize the frame.
	 */
	public TitleScreenPanel() {
		setVisible(true);
		setTitle("M.U.L.E.");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 451, 300);
		
		JPanel contentPane = new JPanel();
		contentPane.setLayout(new BorderLayout());
		contentPane.setBackground(MuleGamePresenter.BACKGROUND_COLOR);
		contentPane.setForeground(MuleGamePresenter.FOREGROUND_COLOR);
		setContentPane(contentPane);
		
		newGameButton = new JButton("New Game");
		newGameButton.setBackground(MuleGamePresenter.FOREGROUND_COLOR);
		newGameButton.setForeground(MuleGamePresenter.BACKGROUND_COLOR);
		contentPane.add(newGameButton, BorderLayout.NORTH);
		
		loadGameButton = new JButton("Load Game");
		loadGameButton.setBackground(MuleGamePresenter.FOREGROUND_COLOR);
		loadGameButton.setForeground(MuleGamePresenter.BACKGROUND_COLOR);
		contentPane.add(loadGameButton, BorderLayout.SOUTH);
		
		logo = new JLabel();
		//logo.setIcon(new ImageIcon("Images\\icon_sell.png"));		
		contentPane.add(logo, BorderLayout.CENTER);
		
		setBounds(100, 100, 450, 300); //explicitly resize window to force repaint
	}
	
	/**
	 * 
	 * @param a the action listener to be added to the new game button
	 */
	public void addNewListener(ActionListener a) {
		newGameButton.addActionListener(a);
	}
	
	/**
	 * 
	 * @param a the action listener to be added to the load game button
	 */
	public void addLoadListener(ActionListener a) {
		loadGameButton.addActionListener(a);
	}
}
